using System;
using System.Collections.Generic;
using System.Text;

namespace Nua.Runtime
{
    public class Converter
    {
        public static Double ConvertToDouble(object value) 
        {
            // Fast Paths
            if (value is Double) return (Double)value;
            if (value is Int32) return (Double)(Int32)value;

            throw new NotImplementedException("can't convert to double");
        }

        public static Boolean ConvertToBoolean(object value) 
        {
            // Fast Paths
            if (value is Int32) return (Int32)value != 0;
            if (value is Boolean) return (Boolean)value;
            if (value == null) return false;

            throw new NotImplementedException("can't convert to bool");
        }
    }
}
